package com.forg.mvc.core;

import java.io.Serializable;

public class RequestID implements Serializable{

    private static final long serialVersionUID = -8788676150719074505L;

    RequestMethodEnum method ;
    
    String path;
    
    public RequestMethodEnum getMethod() {
        return method;
    }

    public void setMethod(RequestMethodEnum method) {
        this.method = method;
    }

    public RequestID(RequestMethodEnum method,String path) {
        this.method = method;
        this.path = path;
    }

    
    @Override
    public boolean equals(Object obj) {
        
        if(obj == null) return false;
        
        if(obj instanceof RequestID){
            RequestID i = (RequestID)obj;
            
            return toString().equals(i.toString());
        }
        
        return false;
    }

    @Override
    public int hashCode() {
        
        if(path == null || method == null) return -1;
        
        return toString().hashCode() ;
    }
    
    @Override
    public String toString(){
        
        return "["+method.getName() + "]" + path;
    }
    
}
